const FLOAT_MIN = 1e-8;

function getDerivative(f) {
    return function (x) {
        return (f(x + FLOAT_MIN) - f(x)) / FLOAT_MIN;
    }
}

//console.log(getDerivative(Math.tan)(2))